body {
    margin: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(#666, #333);
}

.box {
    font-size: 12px;
    width: 30em;
    height: 20em;
    background-color: steelblue;
    border: 0.5em solid black;
    position: relative;
}

.ball {
    position: absolute;
    width: 2em;
    height: 2em;
    background-color: silver;
    border-radius: 50%;
    box-shadow: inset -0.3em -0.3em 0.5em rgba(0, 0, 0, 0.6);
    animation: 
        moveX 2.3s linear infinite alternate,
        moveY 3.7s linear infinite alternate;
}

@keyframes moveX {
    from {left: 0;}
    to {left: calc(30em - 2em);}
}

@keyframes moveY {
    from {top: 0;}
    to {top: calc(20em - 2em);}
}
